<?php

namespace Zeke\Zee;

class Loader
{


    /**
     * 自动载入
     * @param string $className
     * @return bool
     * @author liu.bin 2018/8/2 14:57
     */
    public static function psr4Load($className)
    {
        $aliasName = 'Zeke';
        if(strpos($className,$aliasName) !== 0){
            return false;
            //throw new \Exception('className: ['.$className.'] must be \Zeke\...');
        }

        //加载已Zeke为前缀的类
        $className = substr($className,strlen($aliasName));
        $file = dirname(__DIR__)  .$className . '.php';
        $file = str_replace('\\','/',$file);
        if(is_file($file)){
            include_once $file;
        }
        return true;
    }

}